<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>网络学生信息编辑页面</title>
<link rel="stylesheet" href="layui/css/layui.css" media="all">
<style>
.layui-btn:not(.layui-btn-lg ):not(.layui-btn-sm):not(.layui-btn-xs) {
	height: 34px;
	line-height: 34px;
	padding: 0 8px;
}

.layui-form-label {
	width: 100px;
}
</style>
</head>
<body>
	<form class="layui-form" action="">
		<div class="layui-form-item" style="margin-top: 20px;"
			onsubmit="false">
			<div class="layui-form-item" hidden="hidden">
				<label class="layui-form-label">学生ID:</label>
				<div class="layui-input-inline" style="width: 500px;">
					<input type="text" id="stuid" name="stuid" class="layui-input"
						lay-verify="required" hidden="hidden" readonly="true">
				</div>
			</div>
			 <div class="layui-row">
    <div class="layui-col-xs6">
      <div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*
				</span>学生姓名:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="stuname" name="stuname" required=""
						lay-verify="required|stuname" lay-reqtext="学生姓名不能为空"
						placeholder="请输入学生姓名" value="" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">学生年龄:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="stuage" name="stuage" required=""
						lay-verify="required" lay-reqtext="学生年龄不能为空" placeholder="请输入学生年龄"
						value="" autocomplete="off" class="layui-input">
				</div>
			</div>
			
			
			
			
				<div class="layui-form-item">
			<input type="text" id="stugender2" hidden="hidden" />
				<label class="layui-form-label">学生性别：</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="radio" name="stugender" value="1" title="男" id="sex1">
					<input type="radio" name="stugender" value="2" title="女" id="sex2">
				</div>
			</div>
			
			
			
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*
				</span>学生电话号码:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="stuphone" name="stuphone" required=""
						lay-verify="required|phone|number" lay-reqtext="学生电话号码不能为空"
						placeholder="请输入学生电话号码" value="" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">学历:</label>
							<div class="layui-input-inline" style="width: 350px;">
								<select  name="stuacademic" id="stuacademic" lay-verify="required" lay-search>
									<option value=""></option>
									<option value="小学">小学</option>
									<option value="初中">初中</option>
									<option value="高中">高中</option>
									<option value="大专">大专</option>
									<option value="本科">本科</option>
									<option value="硕士">硕士</option>
									<option value="博士">博士</option>
									<option value="研究生">研究生</option>
								</select>
							</div>
			</div>

			<div class="layui-form-item">
			<input type="text" id="stustate2" hidden="hidden" />
				<label class="layui-form-label"><span style="color: red;">*
				</span>学生状态：</label>
				<div class="layui-input-block">
					<input type="radio" name="stustate" value="1" title="上线" id="s1">
					<input type="radio" name="stustate" value="2" title="下线" id="s2">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">创建时间:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="stucreatetime" name="stucreatetime"
						required="" lay-reqtext="" placeholder="请输入创建时间 yyyy-MM-dd HH:mm:ss"
						autocomplete="off" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">来源渠道:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="sources" name="sources" required=""
						lay-reqtext="来源渠道不能为空" placeholder="请输入来源渠道" value=""
						autocomplete="off" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">来源网址:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="sourceurl" name="sourceurl" required=""
						lay-reqtext="来源网址不能为空" placeholder="请输入来源网址" value=""
						autocomplete="off" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">来源关键词:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="sourcekeyword" name="sourcekeyword"
						required="" lay-reqtext="来源关键词不能为空" placeholder="请输入来源关键词"
						value="" autocomplete="off" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*
				</span>录入人:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="lururen" name="lururen" required=""
						lay-verify="required|lururen" lay-reqtext="录入人不能为空"
					disabled="disabled"	placeholder="请输入录入人姓名" value="" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*
				</span>所属咨询师:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="suoshuzixunshi" name="suoshuzixunshi" required=""
						lay-verify="required|suoshuzixunshi" lay-reqtext="所属咨询师不能为空"
					disabled="disabled"	placeholder="请输入所属咨询师" value="" autocomplete="off"
						class="layui-input">
				</div>
			</div>

			<!-- 	<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">* </span>所属咨询师:</label>
			<div class="layui-input-inline">
				<select name="userid1" id="userid1">
					<option value="">请选择咨询师</option>
				</select>
			</div>
		</div>
		 -->
			<div class="layui-form-item">
				<label class="layui-form-label">微信号:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="WeChat" name="WeChat" required=""
						lay-reqtext="微信号不能为空" placeholder="请输入微信号" value=""
						autocomplete="off" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">QQ号:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="QQ" name="QQ" required=""
						lay-reqtext="QQ号不能为空" placeholder="请输入QQ号" value=""
						autocomplete="off" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">来源部门:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="stusourcedep" name="stusourcedep"
						required="" lay-reqtext="来源部门不能为空" placeholder="请输入来源部门" value=""
						autocomplete="off" class="layui-input">
				</div>
			</div>

		
                <div class="layui-form-item">
			<label class="layui-form-label">是否报备：</label>
			<div class="layui-input-inline" style="width: 350px;">
				<select name="IsReport" id="IsReport">
					<option value="">请选择是否报备</option>
					<option value="1">已报备</option>
					<option value="2">未报备</option>
				</select>
			</div>
		</div>
			<div class="layui-form-item">
				<label class="layui-form-label">课程方向:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="learnforward" name="learnforward"
						required="" lay-reqtext="课程方向不能为空" placeholder="请输入课程方向" value=""
						autocomplete="off" class="layui-input">
				</div>
			</div>

    </div>
    <div class="layui-col-xs6">
               <div class="layui-form-item">
			<label class="layui-form-label required">是否有效：</label>
			<div class="layui-input-inline" style="width: 350px;">
				<select name="IsValid" id="IsValid" lay-verify="" lay-search>
					<option value="">请选择是否有效</option>
					<option value="1">有效</option>
					<option value="2">无效</option>
				</select>
			</div>
		</div>
			<div class="layui-form-item">
				<label class="layui-form-label">打分:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="mark" name="mark" required=""
						lay-reqtext="打分不能为空" placeholder="请输入打分" value=""
						autocomplete="off" class="layui-input">
				</div>
			</div>

			
           <div class="layui-form-item">
			<label class="layui-form-label required">是否回访：</label>
			<div class="layui-input-inline" style="width: 350px;">
				<select name="IsReturnVisit" id="IsReturnVisit" lay-verify="" lay-search>
					<option value="">请选择是否回访</option>
					<option value="1">已回访</option>
					<option value="2">未回访</option>
				</select>
			</div>
		  </div>
		  
			<div class="layui-form-item">
				<label class="layui-form-label">首次回访时间:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="FirstVisitTime" name="FirstVisitTime"
						required="" lay-reqtext="" placeholder="请输入首次回访时间"
						autocomplete="off" class="layui-input">
				</div>
			</div>

			
        <div class="layui-form-item">
			<label class="layui-form-label required">是否上门：</label>
			<div class="layui-input-inline" style="width: 350px;">
				<select name="IsHome" id="IsHome" lay-verify="" lay-search>
					<option value="">请选择是否上门</option>
					<option value="1">已上门</option>
					<option value="2">未上门</option>
				</select>
			</div>
		  </div>
			<div class="layui-form-item">
				<label class="layui-form-label">上门时间:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="HomeTime" name="HomeTime" required=""
						lay-reqtext="" placeholder="请输入上门时间" autocomplete="off"
						class="layui-input">
				</div>
			</div>


			<div class="layui-form-item">
				<label class="layui-form-label">无效原因:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="InvalidReason" name="InvalidReason"
						required="" lay-reqtext="无效原因不能为空" placeholder="请输入无效原因" value=""
						autocomplete="off" class="layui-input">
				</div>
			</div>

		
       <div class="layui-form-item">
			<label class="layui-form-label required">是否缴费：</label>
			<div class="layui-input-inline" style="width: 350px;">
				<select name="Ispay" id="Ispay" lay-verify="" lay-search>
					<option value="">请选择是否缴费</option>
					<option value="1">已缴费</option>
					<option value="2">未缴费</option>
				</select>
			</div>
		  </div>

			<div class="layui-form-item">
				<label class="layui-form-label">缴费时间:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="PayTime" name="PayTime" required=""
						lay-reqtext="" placeholder="请输入缴费时间" autocomplete="off"
						class="layui-input">
				</div>
			</div>



			<div class="layui-form-item">
				<label class="layui-form-label">金额:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="Money" name="Money" required=""
						lay-reqtext="金额不能为空" placeholder="请输入金额" value=""
						autocomplete="off" class="layui-input">
				</div>
			</div>

			
           <div class="layui-form-item">
			<label class="layui-form-label required">是否退费：</label>
			<div class="layui-input-inline" style="width: 350px;">
				<select name="IsReturnMoney" id="IsReturnMoney" lay-verify="" lay-search>
					<option value="">请选择是否退费</option>
					<option value="1">已退费</option>
					<option value="2">未退费</option>
				</select>
			</div>
		  </div>
			
          <div class="layui-form-item">
			<label class="layui-form-label required">是否进班：</label>
			<div class="layui-input-inline" style="width: 350px;">
				<select name="IsInClass" id="IsInClass" lay-verify="" lay-search>
					<option value="">请选择是否进班</option>
					<option value="1">已进班</option>
					<option value="2">未进班</option>
				</select>
			</div>
		  </div>
			<div class="layui-form-item">
				<label class="layui-form-label">进班时间:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="InClassTime" name="InClassTime" required=""
						lay-reqtext="" placeholder="请输入进班时间" autocomplete="off"
						class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">进班备注:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="InClassContent" name="InClassContent"
						required="" lay-reqtext="进班备注不能为空" placeholder="请输入进班备注"
						autocomplete="off" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">退费原因:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="RefundReason" name="RefundReason"
						required="" lay-reqtext="退费原因不能为空" placeholder="请输入退费原因"
						autocomplete="off" class="layui-input">
				</div>
			</div>


			<div class="layui-form-item">
				<label class="layui-form-label">定金金额:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="DepositMoney" name="DepositMoney"
						required="" lay-reqtext="定金金额不能为空" placeholder="请输入定金金额"
						autocomplete="off" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">定金时间:</label>
				<div class="layui-input-inline" style="width: 350px;">
					<input type="text" id="DepositTime" name="DepositTime" required=""
						lay-reqtext="" placeholder="请输入定金时间" autocomplete="off"
						class="layui-input">
				</div>
			</div>
    </div>
  </div>
			
			
  
			<div class="layui-btn-container" style="text-align: center;">
				<button class="layui-btn" lay-filter="stusEditBtu" lay-submit="">
					修改</button>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="layui/layui.js"></script>
	<script src="js/Global.js" type="text/javascript" charset="utf-8"></script>
	<script>
		//加载了layui的form模块
		layui.use([ 'form' ], function() {
			var form = layui.form, layer = layui.layer, $ = layui.$;
			form.verify({
				stuname : function(value, item) { //value：表单的值、item：表单的DOM对象
					if (!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$")
							.test(value)) {
						return '学生名不能有特殊字符';
					}
					if (/(^\_)|(\__)|(\_+$)/.test(value)) {
						return '学生名首尾不能出现下划线\'_\'';
					}
					if (/^\d+\d+\d$/.test(value)) {
						return '学生名不能全为数字';
					}

					//如果不想自动弹出默认提示框，可以直接返回 true，这时你可以通过其他任意方式提示（v2.5.7 新增）
					if (value === 'name' || value === 'stuname'
							|| value === 'sb') {
						return '学生名不能为敏感词';
					}
				}

				//我们既支持上述函数式的方式，也支持下述数组的形式
				//数组的两个值分别代表：[正则匹配、匹配不符时的提示文字]
				,
				pass : [ /^[\S]{6,12}$/, '密码必须6到12位，且不能出现空格' ]
			});
			
			setTimeout(function(){
				if($("#stustate2").val()==1){
					$("#s1").attr("checked",true);
					 form.render('radio');
				}else if($("#stustate2").val()==2){
					$("#s2").attr("checked",true);
					 form.render('radio');
				}
			},200);
			
			
			setTimeout(function(){
				if($("#stugender2").val()==1){
					$("#sex1").attr("checked",true);
					 form.render('radio');
				}else if($("#stugender2").val()==2){
					$("#sex2").attr("checked",true);
					 form.render('radio');
				}
			},200);
			
			//监听提交
			form.on('submit(stusEditBtu)', function(data) {
				var d = data.field; //表单中的数据，定义一个对象来接收
				d.method = "update";
				//通过ajax向数据库提交数据了
				console.log(d); //提交之前的一个数据验证、通过打印的方式先手动的去判断一下这个数据
				var url = globalData.server + 'public/updateStudents';
				$.post(url, d, function(data) {
					if (data.count > 0) {
						console.log('修改成功');
						var index = parent.layer.getFrameIndex(window.name); //获取当前窗口的name
						parent.layer.close(index); //关闭窗口
					} else if (data.count == -1) {
						layer.msg("修改失败，学生名不能重复！！！", {
							icon : 2
						});
					}
				}, "json");
				return false;
			});
		});
		layui.use('laydate', function() {
			var laydate = layui.laydate;
			//同时绑定多个时间选择器
			laydate.render({
				elem : '#stucreatetime',
				type : 'datetime'
			});
			laydate.render({
				elem : '#FirstVisitTime',
				type : 'datetime'
			});
			laydate.render({
				elem : '#HomeTime',
				type : 'datetime'
			});
			laydate.render({
				elem : '#PayTime',
				type : 'datetime'
			});
			laydate.render({
				elem : '#InClassTime',
				type : 'datetime'
			});
			laydate.render({
				elem : '#DepositTime',
				type : 'datetime'
			});
		});
	</script>
</body>
</html>